package com.cks.eduservice.controller;


import com.cks.commonutils.R;
import com.cks.eduservice.entity.EduVideo;
import com.cks.eduservice.entity.chapter.VideoVo;
import com.cks.eduservice.service.EduVideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 课程视频 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2022-01-18
 */
@RestController
@RequestMapping("/eduservice/edu-video")
@CrossOrigin
public class EduVideoController {

    @Autowired
    private EduVideoService eduVideoService;

    //添加小节
    @PostMapping("/addVideo")
    public R addVideo(@RequestBody EduVideo eduVideo){
       eduVideoService.save(eduVideo);
        return  R.ok();
    }

    //修改小节
    @PostMapping("/updateVideo")
    public R updateVideo(@RequestBody EduVideo eduVideo){
        eduVideoService.updateById(eduVideo);
        return  R.ok();
    }
    //删除小节
    @DeleteMapping("{Videoid}")
    public R delVideo(@PathVariable String Videoid){
        //System.out.println(Videoid);
        eduVideoService.removeById(Videoid);
        return  R.ok();
    }


}

